import Layout from '@/layout/index.vue'
import component from 'element-plus/es/components/tree-select/src/tree-select-option.mjs'

export default [
  {
    path: '/',
    name: 'home',
    redirect: '/dashboard/console',
    hidden: true
  },
  {
    path: '/login',
    name: 'login',
    meta: { key: 'login', title: '用户登录' },
    component: () => import('@/views/auth/login.vue')
  },
  {
    path: '/error',
    redirect: '/error/404',
    meta: { key: 'error', title: '错误' },
    component: Layout,
    children: [
      {
        path: '401',
        name: 'error_401',
        meta: { key: 'error_401', title: '没有权限访问', ontab: false },
        component: () => import('@/views/error/401.vue')
      },
      {
        path: '403',
        name: 'error_403',
        meta: { key: 'error_403', title: '未授权访问', ontab: false },
        component: () => import('@/views/error/403.vue')
      },
      {
        path: '404',
        name: 'error_404',
        meta: { key: 'error_404', title: '页面不存在', ontab: false },
        component: () => import('@/views/error/404.vue')
      },
      {
        path: '500',
        name: 'error_500',
        meta: { key: 'error_500', title: '系统错误', ontab: false },
        component: () => import('@/views/error/500.vue')
      }
    ]
  },
  {
    path: '/dashboard',
    name: 'dashboard',
    meta: { key: 'dashboard', title: '仪表盘' },
    component: Layout,
    children: [
      {
        path: 'console',
        name: 'dashboard_console',
        meta: { key: 'dashboard_console', title: '首页仪表盘', ontab: true },
        component: () => import('@/views/dashboard/console.vue')
      }
    ]
  },
  {
    path: '/center',
    name: 'center',
    meta: { key: 'center', title: '用户中心' },
    redirect: '/center/info',
    component: Layout,
    children: [
      {
        path: 'banner',
        name: 'center_banner',
        meta: { key: 'center_banner', title: 'BANNER管理', ontab: true },
        component: () => import('@/views/banner/index.vue'),
        children: [
          {
            path: 'create',
            name: 'center_banner_create',
            meta: { key: 'center_banner_create', title: '添加BANNER', ontab: false },
            component: () => import('@/views/banner/form.vue')
          },
          {
            path: 'update/:id',
            name: 'center_banner_update',
            meta: { key: 'center_banner_update', title: '修改BANNER', ontab: false },
            component: () => import('@/views/banner/form.vue')
          }
        ]
      },
      {
        path: 'info',
        name: 'center_info',
        meta: { key: 'center_info', title: '个人信息', ontab: true },
        component: () => import('@/views/auth/info.vue')
      },
      {
        path: 'password',
        name: 'center_password',
        meta: { key: 'center_password', title: '修改密码', ontab: true },
        component: () => import('@/views/auth/password.vue')
      }
    ]
  },
  {
    path: '/course',
    name: 'course',
    meta: { key: 'course', title: '课程管理' },
    redirect: '/course/search',
    component: Layout,
    children: [
      {
        path: 'category',
        name: 'course_category',
        meta: { key: 'course_category', title: '分类管理', ontab: true },
        component: () => import('@/views/course/category/index.vue'),
        children: [
          {
            path: 'create',
            name: 'course_category_create',
            meta: { key: 'course_category_create', title: '添加分类', ontab: false },
            component: () => import('@/views/course/category/form.vue')
          },
          {
            path: 'update/:id',
            name: 'course_category_update',
            meta: { key: 'course_category_update', title: '修改分类', ontab: false },
            component: () => import('@/views/course/category/form.vue')
          }
        ]
      },
      {
        path: 'lesson',
        name: 'course_lesson',
        meta: { key: 'course_lesson', title: '课程管理', ontab: true },
        component: () => import('@/views/course/lesson/index.vue'),
        children: [
          {
            path: 'create',
            name: 'course_lesson_create',
            meta: { key: 'course_lesson_create', title: '添加课程', ontab: false },
            component: () => import('@/views/course/lesson/form.vue')
          },
          {
            path: 'update/:id',
            name: 'course_lesson_update',
            meta: { key: 'course_lesson_update', title: '修改课程', ontab: false },
            component: () => import('@/views/course/lesson/form.vue')
          },
          {
            path: 'update/:id/content',
            name: 'course_lesson_content',
            meta: { key: 'course_lesson_content', title: '课程内容修改', ontab: false },
            component: () => import('@/views/course/lesson/content.vue')
          }
        ]
      },
      {
        path: 'lesson/:lessonId/chapter',
        name: 'course_lesson_chapter',
        meta: { key: 'course_lesson_chapter', title: '章节管理', ontab: true },
        component: () => import('@/views/course/chapter/index.vue'),
        children: [
          {
            path: 'create',
            name: 'course_lesson_chapter_create',
            meta: { key: 'course_lesson_chapter_create', title: '新建章节', ontab: false },
            component: () => import('@/views/course/chapter/form.vue')
          },
          {
            path: 'update/:id',
            name: 'course_lesson_chapter_update',
            meta: { key: 'course_lesson_chapter_update', title: '修改章节', ontab: false },
            component: () => import('@/views/course/chapter/form.vue')
          }
        ]
      },
      {
        path: 'lesson/:lessonId/ebooks',
        name: 'course_lesson_ebook',
        meta: { key: 'course_lesson_ebook', title: '资料管理', ontab: true },
        component: () => import('@/views/course/ebook/index.vue')
      }
    ]
  },
  {
    path: '/education',
    redirect: '/education/students',
    meta: { key: 'education', title: '教务管理' },
    component: Layout,
    children: [
      {
        path: 'students',
        name: 'education_students',
        meta: { key: 'education_students', title: '学员管理', ontab: true },
        component: () => import('@/views/education/students/index.vue'),
        children: [
          {
            path: 'update/:id',
            name: 'education_students_update',
            meta: { key: 'education_students_update', title: '修改学员', ontab: false },
            component: () => import('@/views/education/students/form.vue')
          }
        ]
      },
      {
        path: 'students/:id/study',
        name: 'education_students_study',
        meta: {key: 'education_students_study', title: '学员学习记录', ontab: true},
        component: () => import('@/views/education/students/study/index.vue')
      },
      {
        path: 'students/:accountId/study/:lessonId/logs',
        name: 'education_students_study_log',
        meta: {key: 'education_students_study_log', title: '学员课程学习日志', ontab: false},
        component: () => import('@/views/education/students/study/logs.vue')
      },
      {
        path: 'lessons',
        name: 'education_lessons',
        meta: { key: 'education_lessons', title: '开通课程管理', ontab: true },
        component: () => import('@/views/education/lesson/index.vue')
      }
    ]
  },
  {
    path: '/order',
    redirect: '/order/search',
    component: Layout,
    meta: {key: 'order', title: '订单管理'},
    children: [
        {
            path: 'search',
            name: 'order_search',
            meta: {key: 'order_search', title: '订单管理', ontab: true},
            component: () => import('@/views/order/index.vue')
        }
    ]
  }
]
